package com.hl.card.modular.packBack.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.hl.card.common.util.HttpURLClient;
import com.hl.card.common.util.ResponseData;
import com.hl.card.modular.packBack.service.IntegralManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class IntegralManageServiceImpl implements IntegralManageService {
	//支付中心接口的地址
	@Value("${dismemberapply.pay.baseUrl}")
	private String baseUrl;
	@Autowired
	private ResponseData responseData;
	@Value("${dismemberapply.ka_ip}")
	private String ip;  //卡包项目IP
	@Override
	public JSONObject queryIntegralManage(Integer start, Integer end, String createTime, String endTime,
			String flowType, String merchantOrderNumber, String scoreFlowNumber,String dealRecordNumber,String othersAccount,String scoreFlowDirection) {
		Map<String,String> paramMap=new HashMap<String, String>();
		paramMap.put("start", start+"");
		paramMap.put("end", end+"");
		    if(createTime!=null&&createTime!=""){
           	paramMap.put("createTime", createTime);
           	}
           	if(endTime!=null&&endTime!=""){
	           	paramMap.put("endTime", endTime);
	           	}
           	if(flowType!=null&&flowType!=""){
           	 	paramMap.put("flowType", flowType);
	           	}
           	if( scoreFlowNumber!=null&&scoreFlowNumber!=""){
           		paramMap.put("scoreFlowNumber", scoreFlowNumber);
	           	}
           	if(merchantOrderNumber!=null&&merchantOrderNumber!=""){
           		paramMap.put("merchantOrderNumber", merchantOrderNumber);
	           	}    
        	if(dealRecordNumber!=null&&dealRecordNumber!=""){
           		paramMap.put("dealRecordNumber", dealRecordNumber);
	           	}   
        	if(othersAccount!=null&&othersAccount!=""){
           		paramMap.put("othersAccount", othersAccount);	
           	} 
        	if(scoreFlowDirection!=null&&scoreFlowDirection!=""){
           		paramMap.put("scoreFlowDirection", scoreFlowDirection);	
           	}
		String result= HttpURLClient.post(paramMap, baseUrl + "/api/saScoreFlow/webList");
		

		 responseData.setData(JSONObject.parse(result));
		 responseData.setMsg("操作成功");
		 responseData.setStatus("1");
		 
		return JSONObject.parseObject(result);
	}

}
